﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace Reddit.Data
{

    [CollectionDataContract]
    public abstract class DataContainerCollection : IEnumerable<DataContainer>
    {
        protected IList<DataContainer> DataContainers = new List<DataContainer>();

        public abstract Type[] Types { get; }

        protected void Add(DataContainer item)
        {
            DataContainers.Add(item);
        }


        #region IEnumerable<DataContainer> Members

        public IEnumerator<DataContainer> GetEnumerator()
        {
            return this.DataContainers.AsEnumerable<DataContainer>().GetEnumerator();
        }

        #endregion

        #region IEnumerable Members

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return this.DataContainers.GetEnumerator();
        }

        #endregion
    }
}
